package cdc.retrofit.official.rxjava;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import rx.Scheduler;
import rx.schedulers.Schedulers;

import static rx.schedulers.Schedulers.io;
public class RxJavaObserveOnMainThread {
	 public static void main(String... args) {
		    Scheduler observeOn = Schedulers.computation(); // Or use mainThread() for Android.

		    Retrofit retrofit = new Retrofit.Builder()
		        .baseUrl("http://example.com")
		        .addCallAdapterFactory(new ObserveOnMainCallAdapterFactory(observeOn))
		        .addCallAdapterFactory(RxJavaCallAdapterFactory.createWithScheduler(io()))
		        .build();

		    // Services created with this instance that use Observable will execute on the 'io' scheduler
		    // and notify their observer on the 'computation' scheduler.
		  }
}
